package org.apache.flink.runtime.rest.messages.taskmanager;

import org.apache.flink.runtime.rest.HttpMethodWrapper;
import org.apache.flink.runtime.rest.handler.taskmanager.ResourceProviderCustomLogHandler;
import org.apache.flink.runtime.rest.messages.EmptyRequestBody;
import org.apache.flink.runtime.rest.messages.LogFileNamePathParameter;
import org.apache.flink.runtime.rest.messages.RuntimeUntypedResponseMessageHeaders;

/** Headers for the {@link ResourceProviderCustomLogHandler}. */
public class ResourceProvideCustomLogHeaders
        implements RuntimeUntypedResponseMessageHeaders<
                EmptyRequestBody, ResourceProviderFileMessageParameters> {

    private static final ResourceProvideCustomLogHeaders INSTANCE = new ResourceProvideCustomLogHeaders();

    private static final String URL =
            String.format(
                    "/providermanagers/:%s/logs/:%s",
                    ResourceProviderIdPathParameter.KEY, LogFileNamePathParameter.KEY);

    @Override
    public Class<EmptyRequestBody> getRequestClass() {
        return EmptyRequestBody.class;
    }

    @Override
    public ResourceProviderFileMessageParameters getUnresolvedMessageParameters() {
        return new ResourceProviderFileMessageParameters();
    }

    @Override
    public HttpMethodWrapper getHttpMethod() {
        return HttpMethodWrapper.GET;
    }

    @Override
    public String getTargetRestEndpointURL() {
        return URL;
    }

    public static ResourceProvideCustomLogHeaders getInstance() {
        return INSTANCE;
    }
}
